# Maintainer: Ronald van Haren <ronald.archlinux.org>
# Contributor: Jochem Kossen <j.kossen@home.nl>
# Contributor: Jason Chu <jason.archlinux.org>

pkgname=latex2html
pkgver=2020.2
pkgrel=1
pkgdesc="a convertor written in Perl that converts LaTeX documents to HTML."
arch=('any')
url="https://www.ctan.org/pkg/latex2html/"
depends=('perl' 'ghostscript' 'texlive-core' 'libpng' 'giflib' 'netpbm')
license=('GPL2')
source=($pkgname-$pkgver.tar.gz::https://github.com/latex2html/latex2html/archive/v$pkgver.tar.gz
 install-destdir.patch)
sha1sums=('5e5eaa1e3c32e6f65590177ec1dd3adaa21e7a13'
          '7b654c41779b8387010b69abe4e5aa51d583c278')

prepare() {
        cd $pkgname-$pkgver
        patch -Np0 -i "${srcdir}"/install-destdir.patch
}

build() {
	cd $pkgname-$pkgver
	./configure --prefix=/usr \
	    --shlibdir=/usr/lib/$pkgname \
	    --with-texpath=/usr/share/texmf/tex/latex/html \
	    --enable-gif \
	    --enable-png

	make
}

package() {
	cd $pkgname-$pkgver
	make DESTDIR="${pkgdir}" install
	
	# set correct permission on executables
#	chmod 755 "$pkgdir"/usr/bin/{pstoimg,texexpand,latex2html}
}
